package com.example.cnedujnux2022101878;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.*;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.*;

import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class CalculateScoreTest {

    @Rule
    public ActivityScenarioRule<MainActivity> activityRule =
            new ActivityScenarioRule<>(MainActivity.class);

    @Test
    public void testCalculateScore() {
        onView(withId(R.id.editTextInput))
                .perform(typeText("10,10,3,5"), closeSoftKeyboard());

        onView(withText("CALCULATE"))
                .perform(click());

        onView(withText("Total score is:49"))
                .check(matches(isDisplayed()));
    }
}
